package com.design.composite.org;

public class CompositeDemo {
    public static void main(String[] args) {
        // 创建公司
        Company company = new Company("ABC Corporation");

        // 创建部门和员工
        Department department1 = new Department("HR Department");
        Department department2 = new Department("Finance Department");

        Employee employee1 = new Employee("John", 5000);
        Employee employee2 = new Employee("Jane", 6000);
        Employee employee3 = new Employee("Mike", 5500);
        Employee employee4 = new Employee("Alice", 6500);

        // 构建组织结构
        department1.addEmployee(employee1);
        department1.addEmployee(employee2);
        department2.addEmployee(employee3);
        department2.addEmployee(employee4);

        company.addDepartment(department1);
        company.addDepartment(department2);

        // 显示组织结构
        company.display();

        // 计算总薪资
        double totalSalary = company.getSalary();
        System.out.println("Total Salary: " + totalSalary);
    }
}
